home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / lha101u.zip / LHA101U.DIF < prev    next >
Text File  |  1992-09-23  |  10KB  |  377 lines

  1. *** lharc.c.orig    Fri Apr 24 11:01:24 1992
  2. --- lharc.c    Wed Sep 23 10:27:19 1992
  3. ***************
  4. *** 25,30 ****
  5. --- 25,34 ----
  6.   /*  V0.03  LHa for UNIX                1991.12.17  M.Oki    */
  7.   /*  V0.04  LHa for UNIX    beta version        1992.01.20  M.Oki    */
  8.   /*  V1.00  LHa for UNIX    Fixed            1992.03.19  M.Oki    */
  9. + /*  V1.01u LHa for UNIX    archive .lzh extension    1992.04.24  G.Roelofs    */
  10. + /*    "     "   "   "   chmod/chown, suid    1992.05.02  T.Kloos    */
  11. + /*    "     "   "   "   better extension fix    1992.06.27  J.P.Radley    */
  12. + /*    "     "   "   "   chown(-1), =- bugfixes    1992.09.22  G.Roelofs    */
  13.   /*----------------------------------------------------------------------*/
  14.   
  15.   #include "lharc.h"
  16. ***************
  17. *** 48,53 ****
  18. --- 52,58 ----
  19.   char    expanded_archive_name[FILENAME_LENGTH];
  20.   char    temporary_name[FILENAME_LENGTH];
  21.   char    backup_archive_name[FILENAME_LENGTH];
  22. + char    *progname;
  23.   
  24.   /* static functions */
  25.   static void sort_files();
  26. ***************
  27. *** 106,114 ****
  28.   LHx      for MSDOS V C2.01 Copyright(C) 1990  H.Yoshizaki\n\
  29.   LHx(arc) for OSK   V 2.01  Modified     1990  Momozou\n\
  30.   LHa      for UNIX  V 1.00  Copyright(C) 1992  Masaru Oki\n\
  31.   ");
  32.     fprintf(stderr, "\
  33. ! usage: lha [-]{axelvudmcp}[qvnfodizg012][w=<dir>] archive_file [file...]\n\
  34.   commands:                           options:\n\
  35.    a   Add(or replace) to archive      q  quiet\n\
  36.    x,e EXtract from archive            v  verbose\n\
  37. --- 111,120 ----
  38.   LHx      for MSDOS V C2.01 Copyright(C) 1990  H.Yoshizaki\n\
  39.   LHx(arc) for OSK   V 2.01  Modified     1990  Momozou\n\
  40.   LHa      for UNIX  V 1.00  Copyright(C) 1992  Masaru Oki\n\
  41. + LHa      for UNIX  V 1.01u Tom Kloos, Jean-Pierre Radley, Greg Roelofs 1992\n\
  42.   ");
  43.     fprintf(stderr, "\
  44. ! usage: %s [-]{axelvudmcp}[qvnfodizg012][w=<dir>] archive_file [file...]\n\
  45.   commands:                           options:\n\
  46.    a   Add(or replace) to archive      q  quiet\n\
  47.    x,e EXtract from archive            v  verbose\n\
  48. ***************
  49. *** 122,128 ****
  50.                                        z  files not compress (a/u)\n\
  51.                                        g  [Generic] format (for compatibility)\n\
  52.                                        0/1/2 header level (a/u)\n\
  53. ! ");
  54.   #ifdef EUC
  55.     fprintf (stderr, "\
  56.                                        e  TEXT code convert from/to EUC\n\
  57. --- 128,134 ----
  58.                                        z  files not compress (a/u)\n\
  59.                                        g  [Generic] format (for compatibility)\n\
  60.                                        0/1/2 header level (a/u)\n\
  61. ! ", progname);
  62.   #ifdef EUC
  63.     fprintf (stderr, "\
  64.                                        e  TEXT code convert from/to EUC\n\
  65. ***************
  66. *** 138,143 ****
  67. --- 144,151 ----
  68.   {
  69.     char *p , inpbuf[256];
  70.   
  71. +   progname = argv[0];
  72.     if (argc < 2)
  73.       print_tiny_usage_and_exit ();
  74.     if (argc < 3) {
  75. ***************
  76. *** 230,236 ****
  77.           case '1':    header_level = HEADER_LEVEL1; break;
  78.           case '2':    header_level = HEADER_LEVEL2; break;
  79.           default:
  80. !           fprintf(stderr, "LHa: Unknown option '%c'.\n", p[-1]);
  81.             exit(1);
  82.           }
  83.       }
  84. --- 238,244 ----
  85.           case '1':    header_level = HEADER_LEVEL1; break;
  86.           case '2':    header_level = HEADER_LEVEL2; break;
  87.           default:
  88. !           fprintf(stderr, "%s: Unknown option '%c'.\n", progname, p[-1]);
  89.             exit(1);
  90.           }
  91.       }
  92. ***************
  93. *** 303,309 ****
  94.   message_1 (title, subject, name)
  95.        char *title, *subject, *name;
  96.   {
  97. !   fprintf (stderr, "LHa: %s%s ", title, subject);
  98.     fflush (stderr);
  99.   
  100.     if (errno == 0)
  101. --- 311,317 ----
  102.   message_1 (title, subject, name)
  103.        char *title, *subject, *name;
  104.   {
  105. !   fprintf (stderr, "%s: %s%s ", progname, title, subject);
  106.     fflush (stderr);
  107.   
  108.     if (errno == 0)
  109. ***************
  110. *** 570,576 ****
  111.         {
  112.       flags[i] = 0x04;
  113.       fprintf (stderr,
  114. !          "LHa: Cannot access \"%s\", ignored.\n", filev[i]);
  115.         }
  116.       else
  117.         {
  118. --- 578,584 ----
  119.         {
  120.       flags[i] = 0x04;
  121.       fprintf (stderr,
  122. !          "%s: Cannot access \"%s\", ignored.\n", progname, filev[i]);
  123.         }
  124.       else
  125.         {
  126. ***************
  127. *** 582,588 ****
  128.         {
  129.           flags[i] = 0x04;
  130.           fprintf (stderr,
  131. !              "LHa: Cannot archive \"%s\", ignored.\n", filev[i]);
  132.         }
  133.         }
  134.     errno = 0;
  135. --- 590,596 ----
  136.         {
  137.           flags[i] = 0x04;
  138.           fprintf (stderr,
  139. !              "%s: Cannot archive \"%s\", ignored.\n", progname, filev[i]);
  140.         }
  141.         }
  142.     errno = 0;
  143. ***************
  144. *** 859,864 ****
  145. --- 867,873 ----
  146.         if (cmd == CMD_EXTRACT || cmd == CMD_LIST) return stdin;
  147.         else return NULL;
  148.       }
  149. + #ifndef USG
  150.     if (p = (char *)rindex(archive_name,'.'))
  151.       {
  152.         if ( strucmp(".LZH",p)==0
  153. ***************
  154. *** 872,877 ****
  155. --- 881,887 ----
  156.           return fp;
  157.         }
  158.       }
  159. + #endif
  160.   
  161.     if ( open_old_archive_1 (archive_name, &fp) )
  162.           return fp;
  163. ***************
  164. *** 899,907 ****
  165.       return NULL;
  166.     }
  167.   */
  168. ! /*  sprintf( expanded_archive_name , "%s.lzh",archive_name);
  169.     archive_name = expanded_archive_name;
  170. - */
  171.     return NULL;
  172.   }
  173.   
  174. --- 909,916 ----
  175.       return NULL;
  176.     }
  177.   */
  178. !   sprintf( expanded_archive_name , "%s.lzh",archive_name);
  179.     archive_name = expanded_archive_name;
  180.     return NULL;
  181.   }
  182.   
  183. *** lhext.c.orig    Fri Apr 24 11:01:26 1992
  184. --- lhext.c    Wed Sep 23 09:51:47 1992
  185. ***************
  186. *** 131,136 ****
  187. --- 131,137 ----
  188.   LzHeader *hdr;
  189.   {
  190.     time_t utimebuf[2];
  191. +   unsigned myuid;
  192.   
  193.     /* adjust file stamp */
  194.     utimebuf[0] = utimebuf[1] = hdr->unix_last_modified_stamp;
  195. ***************
  196. *** 140,152 ****
  197.         || hdr->extend_type == EXTEND_OS68K
  198.         || hdr->extend_type == EXTEND_XOSK)
  199.       {
  200.   #ifdef NOT_COMPATIBLE_MODE
  201.         Please need your modification in this space.
  202.   #else
  203. !       chmod (name, hdr->unix_mode);
  204.   #endif
  205. -       if(!getuid())
  206. -         chown (name, hdr->unix_uid, hdr->unix_gid);
  207.         errno = 0;
  208.       }
  209.   }
  210. --- 141,159 ----
  211.         || hdr->extend_type == EXTEND_OS68K
  212.         || hdr->extend_type == EXTEND_XOSK)
  213.       {
  214. + #if 0      /* GRR:  chown(,-1,) is not valid argument */
  215. +       if (!myuid)
  216. +           chown (name, hdr->unix_uid, hdr->unix_gid);
  217. +       else if (myuid == hdr->unix_uid)
  218. +           chown (name, -1           , hdr->unix_gid);
  219. + #endif
  220. +       if ((myuid = getuid()) == hdr->unix_uid  ||  myuid == 0)
  221. +           chown (name, hdr->unix_uid, hdr->unix_gid);
  222.   #ifdef NOT_COMPATIBLE_MODE
  223.         Please need your modification in this space.
  224.   #else
  225. !       chmod (name, hdr->unix_mode); /* Do this after chown so suid stays */
  226.   #endif
  227.         errno = 0;
  228.       }
  229.   }
  230. *** lhlist.c.orig    Fri Apr 24 11:01:32 1992
  231. --- lhlist.c    Sat May  2 16:27:32 1992
  232. ***************
  233. *** 139,144 ****
  234. --- 139,145 ----
  235.     register int mode;
  236.     register char *p;
  237.     char method[6];
  238. +   char modebits[10];
  239.   
  240.     if (verbose)
  241.       printf ("%s\n", hdr->name);
  242. ***************
  243. *** 150,166 ****
  244.     {
  245.         case EXTEND_UNIX:
  246.           mode=hdr->unix_mode;
  247. !       printf ("%c%c%c%c%c%c%c%c%c%4d/%-4d",
  248. !           ((mode & UNIX_OWNER_READ_PERM)  ? 'r' : '-'),
  249. !           ((mode & UNIX_OWNER_WRITE_PERM) ? 'w' : '-'),
  250. !           ((mode & UNIX_OWNER_EXEC_PERM)  ? 'x' : '-'),
  251. !           ((mode & UNIX_GROUP_READ_PERM)  ? 'r' : '-'),
  252. !           ((mode & UNIX_GROUP_WRITE_PERM) ? 'w' : '-'),
  253. !           ((mode & UNIX_GROUP_EXEC_PERM)  ? 'x' : '-'),
  254. !           ((mode & UNIX_OTHER_READ_PERM)  ? 'r' : '-'),
  255. !           ((mode & UNIX_OTHER_WRITE_PERM) ? 'w' : '-'),
  256. !           ((mode & UNIX_OTHER_EXEC_PERM)  ? 'x' : '-'),
  257. !           hdr->unix_uid, hdr->unix_gid);
  258.         break;
  259.       case EXTEND_OS68K:
  260.   /**/    case EXTEND_XOSK: /**/
  261. --- 151,176 ----
  262.     {
  263.         case EXTEND_UNIX:
  264.           mode=hdr->unix_mode;
  265. !       modebits[0]=((mode & UNIX_OWNER_READ_PERM)  ? 'r' : '-');
  266. !       modebits[1]=((mode & UNIX_OWNER_WRITE_PERM) ? 'w' : '-');
  267. !       if (mode & UNIX_SETUID)
  268. !         modebits[2]='s';
  269. !       else
  270. !         modebits[2]=((mode & UNIX_OWNER_EXEC_PERM) ? 'x' : '-');
  271. !       modebits[3]=((mode & UNIX_GROUP_READ_PERM)  ? 'r' : '-');
  272. !       modebits[4]=((mode & UNIX_GROUP_WRITE_PERM) ? 'w' : '-');
  273. !       if (mode & UNIX_SETGID)
  274. !         modebits[5]='s';
  275. !       else
  276. !         modebits[5]=((mode & UNIX_GROUP_EXEC_PERM) ? 'x' : '-');
  277. !       modebits[6]=((mode & UNIX_OTHER_READ_PERM)  ? 'r' : '-');
  278. !       modebits[7]=((mode & UNIX_OTHER_WRITE_PERM) ? 'w' : '-');
  279. !       if (mode & UNIX_STYCKYBIT)    /* STICKYBIT */
  280. !         modebits[8]='t';
  281. !       else
  282. !           modebits[8]=((mode & UNIX_OTHER_EXEC_PERM)  ? 'x' : '-');
  283. !       modebits[9]='\0';
  284. !       printf ("%s%4d/%-4d", modebits, hdr->unix_uid, hdr->unix_gid);
  285.         break;
  286.       case EXTEND_OS68K:
  287.   /**/    case EXTEND_XOSK: /**/
  288. *** util.c.orig    Fri Apr 24 11:01:36 1992
  289. --- util.c    Thu Aug 27 23:40:13 1992
  290. ***************
  291. *** 196,202 ****
  292.    */
  293.   
  294.   #if defined(NOBSTRING) && !defined(__STDC__)
  295. ! void *
  296.   memmove( dst , src , cnt )
  297.   register char *dst , *src;
  298.   register int cnt;
  299. --- 196,202 ----
  300.    */
  301.   
  302.   #if defined(NOBSTRING) && !defined(__STDC__)
  303. ! char *
  304.   memmove( dst , src , cnt )
  305.   register char *dst , *src;
  306.   register int cnt;
  307. ***************
  308. *** 274,283 ****
  309.       *(cmdname+strlen(RMDIRPATH))=' ';
  310.       strcpy(cmdname+strlen(RMDIRPATH)+1,path);
  311.       if ((stat = system(cmdname))<0)
  312. !         rtn=-1;    /* fork or exec error */
  313.       else if(stat){        /* RMDIR command error */
  314.           errno = EIO;
  315. !         rtn=-1;
  316.       }
  317.       free(cmdname);
  318.       return(rtn);
  319. --- 274,283 ----
  320.       *(cmdname+strlen(RMDIRPATH))=' ';
  321.       strcpy(cmdname+strlen(RMDIRPATH)+1,path);
  322.       if ((stat = system(cmdname))<0)
  323. !         rtn = -1;    /* fork or exec error */
  324.       else if(stat){        /* RMDIR command error */
  325.           errno = EIO;
  326. !         rtn = -1;
  327.       }
  328.       free(cmdname);
  329.       return(rtn);
  330. *** Makefile.orig    Fri Apr 24 11:01:04 1992
  331. --- Makefile    Wed Sep 23 14:29:47 1992
  332. ***************
  333. *** 12,20 ****
  334.   MAKE = make
  335.   CC = cc
  336.   
  337. ! SWITCHES    = -DEUC
  338. ! OPTIMIZE    = -g # -O -fstrength-reduce -fomit-frame-pointer
  339.   
  340.   BINDIR = /usr/local/bin
  341.   MANDIR = /usr/local/man
  342.   MANSECT = n
  343. --- 12,26 ----
  344.   MAKE = make
  345.   CC = cc
  346.   
  347. ! # For Sun/SunOS 4.x:
  348. ! SWITCHES    = -DUSESTRCASECMP # -DEUC
  349. ! # For Amdahl/UTS:
  350. ! #SWITCHES    = -DUSG -DSYSTIME_HAS_NO_TM -DNOBSTRING -DNOINDEX -DNOSTRDUP\
  351. ! #          -DFTIME -DTZSET -DSYSV_SYSTEM_DIR -DNOFTRUNCATE -DNOMKDIR
  352.   
  353. + #OPTIMIZE    = -g # -O -fstrength-reduce -fomit-frame-pointer
  354. + OPTIMIZE    = -O
  355.   BINDIR = /usr/local/bin
  356.   MANDIR = /usr/local/man
  357.   MANSECT = n
  358. ***************
  359. *** 23,29 ****
  360.   INSTALLBIN = -s -m 755
  361.   INSTALLMAN = -m 644
  362.   
  363. ! SUBDIRS = src man
  364.   
  365.   O        = .o
  366.   
  367. --- 29,35 ----
  368.   INSTALLBIN = -s -m 755
  369.   INSTALLMAN = -m 644
  370.   
  371. ! SUBDIRS = src # man
  372.   
  373.   O        = .o
  374.   
  375.